<template>
  <view class="wallet-container">
    <view class="my-money-items">
      <view class="my-money-item">
        <view class="mm-title">可提现</view>
        <view class="mm-value">{{ info.amount }}</view>
      </view>
      <view class="my-money-item">
        <view class="mm-title">提现中</view>
        <view class="mm-value">{{ info.withdrawAmount }}</view>
      </view>
      <view class="withdraw" @click="onWithdraw">去提现</view>
    </view>
    <!-- <view class="wallet-tabs">
      <view class="wallet-tab">交易记录</view>
      <view class="wallet-tab">分佣记录</view>
    </view> -->
    <view class="wallet-title">资金记录</view>
    <view class="wallet-lists">
      <view v-for="(item, i) in list" :key="i" class="wallet-list">
        <view class="wl-main">
          <view class="wl-main-type">{{ item.typeStr }}</view>
          <view class="wl-main-time">{{ item.createTime }}</view>
        </view>
        <view class="wl-money">{{ item.amount }}元</view>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        info: {},
        list: []
      }
    },
    onLoad() {
      this.getWallet()
      this.getloglist()
    },
    methods: {
      getWallet() {
        this.$http({
          url: '/wallet/getWallet',
        }).then(res => {
          
          this.info = res.data.wallet
        })
      },
      getloglist() {
        this.$http({
          url: '/wallet/getWalletLogList',
        }).then(res => {
          this.list = res.data.walletLogList
        })
      },
      onWithdraw() {
        uni.navigateTo({
          url: '../withdraw/index'
        })
      }
    }
  }
</script>

<style lang="less">
  .wallet-container{
    .my-money-items{
      display: flex;
      padding: 40rpx;
      background-color: #cf1322;
      color: #fff;
      position: relative;
    }
    .withdraw{
      position: absolute;
      top: 40rpx;
      right: 20rpx;
      font-size: 30rpx;
      line-height: 50rpx;
      width: 100rpx;
    }
    .my-money-item{
      flex: 1;
      text-align: center;
    }
    .mm-title{
      font-size: 26rpx;
    }
    .mm-value{
      font-size: 36rpx;
    }
    .wallet-tabs{
      display: flex;
      height: 90rpx;
      line-height: 90rpx;
      border-bottom: 1px solid #e8e8e8;
      .wallet-tab{
        flex: 1;
        text-align: center;
        font-size: 28rpx;
        color: #999;
        &.select{
          color: #333;
        }
      }
    }
    .wallet-title{
      line-height: 90rpx;
      font-weight: bold;
      font-size: 32rpx;
      padding-left: 30rpx;
      border-bottom: 1px solid #e8e8e8;
    }
    .wallet-lists{
      padding-left: 30rpx;
    }
    .wallet-list{
      border-bottom: 1px solid #e8e8e8;
      display: flex;
      justify-content: space-between;
      padding: 20rpx 30rpx 20rpx 0;
      align-items: center;
    }
  }
</style>
